package view;

import com.alee.extended.painter.BorderPainter;
import com.alee.laf.panel.WebPanel;
import util.FontLoader;

import javax.swing.BoxLayout;
import javax.swing.JLabel;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;

public class StatView extends WebPanel {

    public StatView (String title, int value) {
        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        Font f = FontLoader.getFont(FontLoader.OPENSANS_BOLD);

        JLabel t = new JLabel(title);
        t.setForeground(Color.GRAY);
        f = f.deriveFont(14f);
        t.setFont(f);

        JLabel v = new JLabel(value + "");
        v.setForeground(Color.darkGray);
        f = FontLoader.getFont(FontLoader.OPENSANS_BOLD);
        f = f.deriveFont(26f);
        v.setFont(f);

        add(t);
        add(v);

        this.setAlignmentX(Component.CENTER_ALIGNMENT);
        t.setAlignmentX(Component.CENTER_ALIGNMENT);
        v.setAlignmentX(Component.CENTER_ALIGNMENT);

        this.setMargin(10);
        BorderPainter bp2 = new BorderPainter ();
        bp2.setRound ( 6 );
        bp2.setWidth ( 1 );
        bp2.setColor ( Color.lightGray );
        this.setPainter ( bp2 );
    }
}
